package com.jdj.framework.core.base.vo;

import java.io.Serializable;

/**
 * 基础响应对象
 * @author caijinbang
 * @date 2019/4/11 20:25
 */
public class BaseResponse<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    private T data;

    private String message;

    private boolean success = true;

    private String code;

    public BaseResponse () {
    }

    /**
     * @param success 是否成功
     * @param code    响应结果码
     * @param message 消息字符
     * @param data    信息对象
     */
    public BaseResponse(boolean success, String code, String message, T data) {
        this.success = success;
        this.code = code;
        this.message = message;
        this.data = data;
    }

    /**
     * @param success 是否成功
     * @param code    响应结果码
     * @param message 消息字符
     */
    public BaseResponse(boolean success, String code, String message) {
        this.success = success;
        this.code = code;
        this.message = message;
    }

    /**
     * @param success 是否成功
     * @param code    响应结果码
     */
    public BaseResponse(boolean success, String code) {
        this.success = success;
        this.code = code;
    }

    /**
     * @param code    响应结果码
     * @param message 消息字符
     * @param data    信息对象
     */
    public BaseResponse(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    /**
     * @param message 消息字符
     * @param data    信息对象
     */
    public BaseResponse(String message, T data) {
        this.message = message;
        this.data = data;
    }

    /**
     * @param data    信息对象
     */
    public BaseResponse(T data) {
        this.data = data;
    }

    /**
     * @param code    响应结果码
     * @param message 消息字符
     */
    public BaseResponse(String code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * @param success 是否成功
     * @param data    信息对象
     */
    public BaseResponse(boolean success, T data) {
        this.success = success;
        this.data = data;
    }

    /**
     * @param success 是否成功
     * @param code    响应结果码
     * @param data    信息对象
     */
    public BaseResponse(boolean success, String code, T data) {
        this.success = success;
        this.code = code;
        this.data = data;
    }

    /**
     * @param message    消息字符
     */
    public BaseResponse(String message) {
        this.message = message;
    }

    /**
     * 消息字符
     *
     * @return
     */
    public String getMessage() {
        return message;
    }

    /**
     * 消息字符
     *
     * @param message
     * @return
     */
    public void setMessage(String message) {
        this.message = message;
    }

    /**
     * 是否成功
     *
     * @return
     */
    public boolean isSuccess() {
        return success;
    }

    /**
     * 是否成功
     *
     * @param success
     * @return
     */
    public BaseResponse setSuccess(boolean success) {
        this.success = success;
        return this;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    /**
     * 响应结果码
     *
     * @return
     */
    public String getCode() {
        return code;
    }

    /**
     * 响应结果码
     *
     * @param code
     */
    public void setCode(String code) {
        this.code = code;
    }
}
